Skip to content

feat: migrate remaining sync decrypt/encrypt calls#8923

Open
bdesoky wants to merge 1 commit into
masterfrom
WCN-284-remainder
Open

feat: migrate remaining sync decrypt/encrypt calls#8923
bdesoky wants to merge 1 commit into
masterfrom
WCN-284-remainder

Conversation

@bdesoky
Copy link
Copy Markdown
Contributor

@bdesoky bdesoky commented Jun 2, 2026

Ticket: WCN-284

This pull request introduces a comprehensive migration from synchronous encryption and decryption methods to their asynchronous counterparts throughout the codebase, with a focus on improving support for v2 encryption. The changes affect key management, wallet operations, transaction verification, and API routes, ensuring better scalability and compatibility with modern cryptographic practices. Additionally, new async verification utilities are introduced, and related tests and error messages are updated accordingly.

Migration to Async Encryption/Decryption:

  • Replaced all usages of encrypt and decrypt with encryptAsync and decryptAsync in wallet logic (lightning.ts, selfCustodialLightning.ts), UTXO coin and transaction verification, and Express API handlers to support v2 encryption and improve non-blocking behavior. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]

Async Key Verification Utilities:

  • Added verifyUserPublicKeyAsync to verifyKey.ts and updated transaction and coin verification logic to use the new async method, while preserving the synchronous version for backward compatibility. [1] [2] [3] [4] [5] [6] [7]

Refactoring and API Consistency:

  • Refactored helper functions and type signatures to be async, including decryption helpers and key derivation logic in Express Lightning routes, to ensure consistency across all API endpoints. [1] [2] [3]

Test and Error Message Updates:

  • Updated tests to use async stubs and improved error messages for decryption failures to reflect the new async flow and provide clearer diagnostics. [1] [2] [3] [4]

Backward Compatibility and Deprecation:

  • Marked synchronous methods as deprecated where appropriate, and provided clear migration paths to async methods, especially in UTXO coin classes and key verification utilities. [1] [2]

These changes collectively modernize the cryptographic operations in the codebase, preparing it for future enhancements and improved security practices.

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Jun 2, 2026

WCN-284

@bdesoky bdesoky force-pushed the WCN-284-remainder branch from de0b432 to 1c11e37 Compare June 2, 2026 20:02
@bdesoky bdesoky marked this pull request as ready for review June 2, 2026 21:08
@bdesoky bdesoky force-pushed the WCN-284-remainder branch from 1c11e37 to e106dc2 Compare June 2, 2026 21:08
@bdesoky bdesoky requested review from a team as code owners June 2, 2026 21:08
@bdesoky bdesoky requested review from Marzooqa and vinhkhangtieu June 2, 2026 21:08
@bdesoky bdesoky force-pushed the WCN-284-remainder branch from e106dc2 to a52f1ae Compare June 3, 2026 13:56
Copy link
Copy Markdown

@vinhkhangtieu vinhkhangtieu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

migrate decrypt/encrypt call to async

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants